#include <moying_comm_lib/publish.h>
#include <moying_proto/robot_basics.pb.h>
#include <moying_proto/geometry.pb.h>
#include <moying_proto_test/pack_log.h>

using namespace moying::communication;
int main()
{
    std::string sch_root_dir = "./";
    log4cplus::Initializer initializer;
    std::string prop_path(sch_root_dir);
    prop_path += "configs/pub_logger.properties";
    log4cplus::PropertyConfigurator::doConfigure(prop_path); 
    logger = std::make_shared<log4cplus::Logger>(log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("main")));

    MoyingCommuPublish pub("*", 50006, "pub");
    pub.setLogCall(&commLogCall, MoyingCommuLogLevels::INFO, true);//设置回调，详见logCall
    pub.setPrintPackCall(&packLogCall); //设True打印所有收发数据至console，设false不打印
    pub.run();

    unsigned int order = 1;
    while (true)
    {
      moying_proto::RobotInfo robot_info;
      robot_info.set_id(order++);
      pub.publish("test_robot_info", robot_info);

      moying_proto::Point2D point_2d;
      point_2d.set_x((double)order);
      pub.publish("test_point2d", point_2d);
      SLEEP(1000);
    }

    return 0;
}
